// Author: Ivan Kazmenko (gassa@mail.ru)
module solution;
import std.algorithm;
import std.conv;
import std.range;
import std.stdio;
import std.string;

void main ()
{
	int n;
	while (readf (" %s", &n) > 0)
	{
		readln;
		auto a = [0] ~ readln.splitter.map !(to !(int)).array;
		foreach_reverse (i; 0..n)
		{
			a[i + 1] -= a[i];
		}
		writeln (a.maxElement);
	}
}
